#pragma once

#include "SequenceNode.h"

#include "ExecutableNode.h"

namespace uml {

SequenceNode::SequenceNode(const QString& umlType)
    : StructuredActivityNode(umlType) {}

void SequenceNode::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    StructuredActivityNode::fromJson(json, errorList);
    JsonSerializable::fromJsonArray(executableNodes_, "executableNodes", json, errorList);
}

void SequenceNode::toJson(QJsonObject& json) {
    StructuredActivityNode::toJson(json);
    JsonSerializable::toJsonArray(executableNodes_, "executableNodes", json);
}

/// <summary>
/// executableNodes getter
/// The ordered set of ExecutableNodes to be sequenced.
/// </summary>
vector<shared_ptr<ExecutableNode>>& SequenceNode::executableNodes() {
    return executableNodes_;
}

} // namespace uml
